<template>
  <div class="comment">
    <div class="usercomment">用户评价</div>
    <div class="more">更多</div>
    <div class="clear"></div>
    <div class="imgcontent">
       <span><img :src="usercommemt.avatar" alt=""></span>
       <span class="username" v-if="usercommemt.uname">{{usercommemt.uname}}</span>
       <span class="username" v-else>匿名用户</span>
    </div>
    <div class="indexcontent">
      {{commentInfo.content}}
    </div>
    <div class="timestyle">
       <span class="time" v-if="commentInfo.created">{{commentInfo.created | showDate}}</span>
       <span class="style">{{commentInfo.style}}</span>
    </div>
    <div v-if="commentInfo.images" ><img  class="imgs" :src="item" v-for="(item,index) in commentInfo.images" :key="index"></div>
    <div v-else class="noimage">暂时该买家未上传买家秀</div>
  </div>
</template>

<script>
import {formatDate} from '../../../common/utils'
export default {
props :{
    commentInfo:{
        type:Object,
        default(){
            return {}
        }
    },
    usercommemt:{
        type:Object,
        default(){
            return {}
        }
    }
},
filters:{
    showDate(value){
        const date = new Date(value*1000)
        return formatDate(date,'yyyy-MM-dd')
    }
}
}
</script>

<style scoped>
.comment{
    background-color: #eee;
    
}
.usercomment{
    float: left;
    width: 60%;
    height: 40px;
    line-height: 40px;
    font-size: 16px;
    font-weight: 700;
    padding-left: 10px;
}
.more{
  float: right;
  height: 40px;
  padding-top: 10px;
  padding-right: 10px;
}
.clear{
    clear: both;
}
.imgcontent{
    border-top: 5px solid #f2f5f8;
    border-bottom: 5px solid #f2f5f8;
}
.imgcontent img{
 width: 40px;
 height: 40px;
 border-radius: 50%;
 vertical-align:middle;
}
.imgcontent .username{
    font-size: 14px;
    margin-left: 10px;
    padding-bottom: 20px;
}
.indexcontent{
    font-size: 14px;
    font-weight: 500;
    font-style: italic;
    line-height: 16px;
    text-indent: 2em;
}
.timestyle{
    margin-top: 6px;
    border-top:1px solid rgb(100, 100, 100);
    border-bottom:1px solid rgb(100, 100, 100)
}
.timestyle .time{
    font-size: 14px;
    margin-left: 20px;
    
}
.timestyle .style{
    color: rgb(50, 173, 147);
    margin-left: 10px;
}
.imgs{
    
    width: 50%;
    height: 50%;
}
.noimage{
   height: 100px;
   background-color: #fff;
   line-height: 100px;
   text-align: center;
   font-size: 18px;
}
</style>